/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.epam.muzalevskiy.third_project.knife;

/**
 * This class realized switching between various enumerated parameters.
 *
 * @author Muzalevskiy Vitaliy
 */
public class KnifeParametersSwitcher {
    
    /**
     * Switching various knife type values.
     * 
     * @param type - <code> String </code> type value of current type.
     * @return - <code> KnifeType </code> value.
     */
    public static KnifeType swithKnifeType(String type){
        KnifeType result = null;
        switch (type) {
            case "нож":
                result = KnifeType.KNIFE;
                break;
            case "кинжал":
                result = KnifeType.DAGGER;
                break;
            case "сабля":
                result = KnifeType.SABER;
                break;
            case "меч":
                result = KnifeType.SWORD;
                break;
            default:
                throw new RuntimeException();
        }
        return result;
    }
    
    /**
     * Switching way of current knife handling.
     *
     * @param handy - <code> String </code> type value of current handy parameter.
     * @return - <code> KnifeHandy </code> value.
     */
    public static KnifeHandy switchKnifeHandy (String handy){
        KnifeHandy result = null;
        switch (handy) {
            case "одноручный":
                result = KnifeHandy.SINGLE_HANDED;
                break;
            case "двуручный":
                result = KnifeHandy.TWO_HANDED;
                break;
            default:
                throw new RuntimeException();
        }
        return result;        
    }
    
    /**
     * Switching of units.
     *
     * @param units
     * @return - <code> Units </code> value.
     */
    public static Units switchUnits(String units){
        Units result = null;
        switch (units) {
            case "см":
                result = Units.SM;
                break;
            case "мм":
                result = Units.MM;
                break;
            default:
                throw new RuntimeException();
        }
        return result;
    }
    
    /**
     * Switching of various knife blade materials.
     *
     * @param material - value of knife blade material.
     * @return - <code> BladeMaterial </code> value.
     */
    public static BladeMaterial switchBladeMaterial(String material){
        BladeMaterial result = null;
        switch (material) {
            case "сталь":
                result = BladeMaterial.STEEL;
                break;
            case "чугун":
                result = BladeMaterial.CAST;
                break;
            case "медь":
                result = BladeMaterial.COPPER;
                break;
            default:
                throw new RuntimeException();
        }
        return result;
    }
    
    /**
     *  Switching of various knife handle materials.
     *
     * @param material - value of knife handle material.
     * @return - <code> HandleMaterial </code> value.
     */
    public static HandleMaterial switchHandleMaterial(String material){
        HandleMaterial result = null;
        switch (material) {
            case "металл":
                result = HandleMaterial.METAL;
                break;
            case "дерево":
                result = HandleMaterial.WOOD;
                break;
            case "пластик":
                result = HandleMaterial.PLASTIC;
                break;
            default:
                throw new RuntimeException();
        }
        return result;
    }
}
